package com.heima.admin.controller.v1;

import com.heima.apis.wemedia.IWemediaClient;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmChannel;
import com.heima.model.wemedia.pojos.WmSensitive;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: liudehuan
 * @description
 * @date: 2023-04-23 15:20
 */
@RestController
@RequestMapping("/api/v1/sensitive")
public class SensitiveController {

    @Autowired
    private IWemediaClient wemediaClient;

    @PostMapping("/list")
    public ResponseResult getSensitiveList(@RequestBody SensitiveDto dto){
        System.out.println(wemediaClient);
        ResponseResult senList = wemediaClient.getSensitives(dto);
        return senList;
    }

    @PostMapping("/save")
    public ResponseResult saveSensitive(@RequestBody WmSensitive sensitive){
        return wemediaClient.saveSensitive(sensitive);
    }

    @PostMapping("/update")
    public ResponseResult updateSensitive(@RequestBody WmSensitive sensitive){
        return wemediaClient.updateSensitive(sensitive);
    }

    @DeleteMapping("/del/{id}")
    public ResponseResult delete(@PathVariable Integer id){
        return wemediaClient.deleteSensitive(id);
    }
}
